'use strict';

const Controller = require('egg').Controller;

class whjtutor extends Controller {
  async index() {
    const data = await this.ctx.service.whjtutor.findAll(this.ctx);
    this.ctx.body = data;
  }
  async create() {
    const ctx = this.ctx;
    const params = ctx.request.body;
    const data = await ctx.service.whjtutor.create(params);
    ctx.body = data;
  }
  async destroy() {
    const ctx = this.ctx;
    const whjtutorId = ctx.params.id;
    const del = await ctx.service.whjtutor.delete(whjtutorId);
    ctx.body = del;
  }
  async update() {
    const ctx = this.ctx;
    const whjtutorId = ctx.params.id;
    const params = ctx.request.body;
    const change = await ctx.service.whjtutor.update(whjtutorId, params);
    ctx.body = change;
  }
  async show() {
    const ctx = this.ctx;
    const id = ctx.params.id;
    const whjtutor = await this.ctx.service.whjtutor.find(id);
    ctx.body = whjtutor;
  }
  async index0() {
    const ctx = this.ctx;
    const name = ctx.params.name;
    console.log(name);
    const data = await this.ctx.service.whjtutor.findAll0(name);
    this.ctx.body = data;
  }
  // eslint-disable-next-line no-dupe-class-members
  async index1() {
    const ctx = this.ctx;
    const teacherid = ctx.params.teacherid;
    console.log(teacherid);
    const data = await this.ctx.service.whjtutor.findAll1(teacherid);
    this.ctx.body = data;
  }

  async index2() {
    const ctx = this.ctx;
    const idnum = ctx.params.idnum;
    console.log(idnum);
    const data = await this.ctx.service.whjtutor.findAll2(idnum);
    this.ctx.body = data;
  }
  // eslint-disable-next-line no-dupe-class-members
  async index3() {
    const ctx = this.ctx;
    const region = ctx.params.region;
    console.log(region);
    const data = await this.ctx.service.whjtutor.findAll3(region);
    this.ctx.body = data;
  }
}
module.exports = whjtutor;
